package com.yzy.tool
{
	import flash.net.LocalConnection;

	public class Utils
	{
		public function Utils()
		{
		}
		
		
		public static function getRandom(min:int,max:int):int{
			return Math.floor(Math.random()*(max-min+1)+min);
		} 
		
		//生成一个随机排列的连续数组
		public static function getRandomArr(array:Array) : Array{
			var returnArr:Array=new Array();
			var tempArr:Array = new Array();
			while(tempArr.length<array.length)
			{
				var tempNum:int = getRandom(0,array.length-1);
				if( tempArr.indexOf(tempNum) == -1)
				{
					tempArr.push(tempNum);
					returnArr.push(array[tempNum]);
				}
			}
			return returnArr;
		}
		
		public static function gc():void{
			try{
				new LocalConnection().connect("gc");
				new LocalConnection().connect("gc");
			}catch(e:Error){}
		}
		
	}
}